package com.handpay.zztong.hp.login.model.modifyloginpwd;

import android.text.TextUtils;
import android.widget.Toast;

import com.handpay.framework.ClientEngine;
import com.handpay.framework.SecureManager;
import com.handpay.framework.fastjson.FastJsonHelper;
import com.handpay.zztong.hp.base.activity.ZZTongActivity;
import com.handpay.zztong.hp.base.callback.BusinessEngineListener;
import com.handpay.zztong.hp.base.model.base.BaseModel;
import com.handpay.zztong.hp.bean.ResponseBean;
import com.handpay.zztong.hp.config.HttpUrlConstant;
import com.handpay.zztong.hp.protocol.BaseProtocolKey;
import com.handpay.zztong.hp.utils.AccountUtils;

import java.util.Hashtable;

/**
 * Created by lyang on 2017/3/16.
 */

public class ModifyLoginPWDModel extends BaseModel {
    private ZZTongActivity mActivity;
    private BusinessEngineListener mBusinessEngineListener ;

    public boolean doModifyResetPasswordPost(ZZTongActivity activity, Hashtable<String, String> params, BusinessEngineListener listener) {
        mBusinessEngineListener = listener;
        mActivity = activity;
        return doPost(activity, HttpUrlConstant.Do_ModifyResetPassword, params, true, true);

    }

    @Override
    public boolean netResponse(String action, byte[] data) {
        boolean bResult = super.netResponse(action, data);
        if (bResult) {
            return true;
        }
        if (action.equals(HttpUrlConstant.Do_ModifyResetPassword)) {
            if (data_type == DATA_TYPE.DATA_TYPE_JSON) {
                ResponseBean respBean = null;
                try {
                    String result = new String(data, "UTF-8");
                    respBean = FastJsonHelper.getObject(result, ResponseBean.class);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (mBusinessEngineListener != null) {
                    mBusinessEngineListener.callbackBusinessResponse(respBean);
                }
            } else {

            }
        }


        return true;
    }
}
